{% import '@SyliusAdmin/shared/helper/avatar.html.twig' as avatar %}
{% import '@SyliusAdmin/shared/helper/dropdown.html.twig' as dropdown %}

{% set dropdown_trigger %}
    <div class="d-flex lh-1 text-reset p-0 cursor-pointer">
        <div {{ sylius_test_html_attribute('user-avatar', user.avatar.path|default(null)) }}>
            {% if user.avatar.path is not defined or user.avatar.path is empty %}
                {{ avatar.small() }}
            {% else %}
                {{ avatar.small(user.avatar.path|imagine_filter('sylius_admin_avatar')) }}
            {% endif %}
        </div>
        <div class="d-none d-xl-block ps-2">
            <div class="mb-1 small text-muted">{{ 'sylius.ui.hello'|trans }}</div>
            <div>{{ user.firstName|default(user.username) }}</div>
        </div>
    </div>
{% endset %}

{{ dropdown.list({ custom_trigger: dropdown_trigger, direction: 'down-end' }, menu_items) }}
